/**
 * @author zhoutao
 *  2010-5-11
 */
package com.jlt.entity.account;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.jlt.entity.BaseEntity;

/**
 * 部门
 * @author zhoutao
 * 
 */
@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "depts")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Dept extends BaseEntity{
	@Column(nullable = false)
	private String name;//部门名称 
	private String description;//备注
	private String status;//是否可用
	private Dept parentDept;//父部门

	// 多对一定义
	@ManyToOne
	// 中间表定义,表名采用默认命名规则
	@JoinColumn(name="parent_id") 
	// 集合按id排序.
	@OrderBy("orderNo")
	// 集合中对象id的缓存.
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Dept getParentDept() {
		return parentDept;
	}

	public void setParentDept(Dept parentDept) {
		this.parentDept = parentDept;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

}
